-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add webpack plugin #526
Conversation
Thanks. I think this can be a lot simpler and I would rather let users set it up themselves instead of including it in Ziggy. I've added some documentation to make this easier for others to find. |
Never mind it was already there and I completely forgot 🤦🏻 |
I already pointed out to several problems with your code that makes it recompile way too many times even when not needed and every time it compiles it does it 2 times as well, with the update happening only the second time, which is a big issue as it can take up to 1 minute for changes to be reflected in a dev env. Aiso, sorry but if we're supposed to build everything ourselves then what's the point of ziggy except being a documentation? The point of plugins is to make those integrations easier and a single point of truth, otherwise every body makes his own things with bugs etc.. That doesn't get updates, needs maintenance on webpack updates and eventually you get fed up and start hating a good thing for not providing an integration to use it |
What are the issues you've run into with those examples? Am I attaching to the wrong hooks?
To provide a I have tried to build plugins/integrations with Webpack multiple times in other projects and it has always caused more problems than it solved and made me wish I hadn't bothered, so I'm especially sceptical of doing anything related to Webpack at all. But I also just don't think it's a big deal to run the artisan command manually once in a while, especially since on most projects I don't think route files are changing super frequently. I'm not completely opposed to adding something like this, but because Webpack sucks to work with so much it has to be really, really simple, add as little code as possible, and be something that's going to be easy for me to maintain. |
The problem is that by adding as a file dependency a file that is not actually a dependency of the bundle it creates a feedback loop, so the php file triggers a command and a rebuild of the whole bundle with the old files (because that's what a file dependency does in webpack), then the new file updated by the command gets picked up by the watchers and retriggers another build. This is something that can only be addressed by separate watchers than the main webpack watchers |
#522 Revisited with a webpack plugin instead
Usage
This runs the command passed to it before the compilation.
If running
mix watch
, it will also watch for changes in config/ziggy.php and routes/ to retrigger this same command which in turn will trigger a rebuild if those files are modified